//
//  EPOSDetailEntity.m
//  BCGenieEffect
//
//  Created by Ios Entity Generator on 2014-03-07 13:03:16
//  Copyright (c) 2014年 Bartosz Ciechanowski. All rights reserved.
//

#import "EPOSDetailEntity.h"

@implementation EPOSDetailEntity

+(id) getEPOSDetailEntityFromDictionary :(NSDictionary *) dic {
//    NSStringEncoding enc = CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000);
//    NSString * proname = [dic objectForKey:@"ProdName"];
//    NSData * prodata = [proname dataUsingEncoding:NSUTF8StringEncoding];
    
    EPOSDetailEntity * detailEntity = [[EPOSDetailEntity alloc]init] ;
//    detailEntity.ProdName = [[NSString alloc] initWithData:prodata encoding:NSUTF8StringEncoding];
    detailEntity.ProdName = [dic objectForKey:@"ProdName"];
    detailEntity.SalesValue = [dic objectForKey:@"SalesValue"];
    detailEntity.PlatePrice = [dic objectForKey:@"PlatePrice"];
    detailEntity.DivDiscountRate = [dic objectForKey:@"DivDiscountRate"];
    detailEntity.OOSErpProdID = [dic objectForKey:@"OOSErpProdID"];
    detailEntity.ColorName = [dic objectForKey:@"ColorName"];
    detailEntity.SizeName = [dic objectForKey:@"SizeName"];
    detailEntity.SaleID = [dic objectForKey:@"SaleID"];
    detailEntity.PromotionRuleDtlID = [dic objectForKey:@"PromotionRuleDtlID"];
    detailEntity.Qty = [dic objectForKey:@"Qty"];
    detailEntity.ProdSeason = [dic objectForKey:@"ProdSeason"];
    detailEntity.BillPrice = [dic objectForKey:@"BillPrice"];
    detailEntity.OOSDiscRate = [dic objectForKey:@"OOSDiscRate"];
    detailEntity.DiscountMoney = [dic objectForKey:@"DiscountMoney"];
    detailEntity.OOSSettlePrice = [dic objectForKey:@"OOSSettlePrice"];
    detailEntity.IsOOS = [dic objectForKey:@"IsOOS"];
    detailEntity.IsDelete = [dic objectForKey:@"IsDelete"];
    detailEntity.Selected = [dic objectForKey:@"Selected"];
    detailEntity.OOSFreeQty = [dic objectForKey:@"OOSFreeQty"];
    detailEntity.PromotionRuleGuid = [dic objectForKey:@"PromotionRuleGuid"];
    detailEntity.PromotionRuleDtlID_Bill = [dic objectForKey:@"PromotionRuleDtlID_Bill"];
    detailEntity.PromotionRuleDtlUsedMoney = [dic objectForKey:@"PromotionRuleDtlUsedMoney"];
    detailEntity.ProdID = [dic objectForKey:@"ProdID"];
    detailEntity.OrgCode = [dic objectForKey:@"OrgCode"];
    detailEntity.PriceType = [dic objectForKey:@"PriceType"];
    detailEntity.PresentFlag = [dic objectForKey:@"PresentFlag"];
    detailEntity.AddMoney = [dic objectForKey:@"AddMoney"];
    detailEntity.DivSalesValue = [dic objectForKey:@"DivSalesValue"];
    detailEntity.CutMoney = [dic objectForKey:@"CutMoney"];
    detailEntity.IntnlBarcode = [dic objectForKey:@"IntnlBarcode"];
    detailEntity.RemarkCode = [dic objectForKey:@"RemarkCode"];
    detailEntity.SuggestPrice = [dic objectForKey:@"SuggestPrice"];
    detailEntity.StaffTicket = [dic objectForKey:@"StaffTicket"];
    detailEntity.SaleDetailID = [dic objectForKey:@"SaleDetailID"];
    detailEntity.BrandID = [dic objectForKey:@"BrandID"];
    detailEntity.OldDiscountRate = [dic objectForKey:@"OldDiscountRate"];
    detailEntity.InnerBarcode = [dic objectForKey:@"InnerBarcode"];
    detailEntity.GuidID = [dic objectForKey:@"GuidID"];
    detailEntity.EditionName = [dic objectForKey:@"EditionName"];
    detailEntity.RetailPrice = [dic objectForKey:@"RetailPrice"];
    detailEntity.ContainerID = [dic objectForKey:@"ContainerID"];
    detailEntity.DecMoney = [dic objectForKey:@"DecMoney"];
    detailEntity.SellerUserID = [dic objectForKey:@"SellerUserID"];
    detailEntity.PresentHandIdx = [dic objectForKey:@"PresentHandIdx"];
    detailEntity.OwnerOrgCode = [dic objectForKey:@"OwnerOrgCode"];
    detailEntity.Orientation = [dic objectForKey:@"Orientation"];
    detailEntity.DiscountRate = [dic objectForKey:@"DiscountRate"];
    detailEntity.OOSMarketGain = [dic objectForKey:@"OOSMarketGain"];
    detailEntity.EntityState = [dic objectForKey:@"EntityState"];
    detailEntity.PriceTypeName = [dic objectForKey:@"PriceTypeName"];
    detailEntity.BrandCode = [dic objectForKey:@"BrandCode"];
    detailEntity.OOSBanggoGain = [dic objectForKey:@"OOSBanggoGain"];
    detailEntity.ProdYear = [dic objectForKey:@"ProdYear"];
    detailEntity.ProdClsID = [dic objectForKey:@"ProdClsID"];
    detailEntity.SeasonCode = [dic objectForKey:@"SeasonCode"];
    detailEntity.ItemNo = [dic objectForKey:@"ItemNo"];
    detailEntity.OOSCompGain = [dic objectForKey:@"OOSCompGain"];
    detailEntity.Remark = [dic objectForKey:@"Remark"];
    detailEntity.SalesMode = [dic objectForKey:@"SalesMode"];
    // edit by maosy,add model params for SalesPrice. edit by 20140326
    detailEntity.SalesPrice = [dic objectForKey:@"SalesPrice"];
    
    return detailEntity ;
}

+(NSMutableDictionary *) getDictionaryFromEPOSDetailEntity :(EPOSDetailEntity* ) detailEntity {
    NSMutableDictionary * dic = [[NSMutableDictionary alloc]init] ;
    [dic setObject:detailEntity.ProdName forKey:@"ProdName"];
    [dic setObject:detailEntity.SalesValue forKey:@"SalesValue"];
    [dic setObject:detailEntity.PlatePrice forKey:@"PlatePrice"];
    [dic setObject:detailEntity.DivDiscountRate forKey:@"DivDiscountRate"];
    [dic setObject:detailEntity.OOSErpProdID forKey:@"OOSErpProdID"];
    [dic setObject:detailEntity.ColorName forKey:@"ColorName"];
    [dic setObject:detailEntity.SizeName forKey:@"SizeName"];
    [dic setObject:detailEntity.SaleID forKey:@"SaleID"];
    [dic setObject:detailEntity.PromotionRuleDtlID forKey:@"PromotionRuleDtlID"];
    [dic setObject:detailEntity.Qty forKey:@"Qty"];
    [dic setObject:detailEntity.ProdSeason forKey:@"ProdSeason"];
    [dic setObject:detailEntity.BillPrice forKey:@"BillPrice"];
    [dic setObject:detailEntity.OOSDiscRate forKey:@"OOSDiscRate"];
    [dic setObject:detailEntity.DiscountMoney forKey:@"DiscountMoney"];
    [dic setObject:detailEntity.OOSSettlePrice forKey:@"OOSSettlePrice"];
    [dic setObject:detailEntity.IsOOS forKey:@"IsOOS"];
    [dic setObject:detailEntity.IsDelete forKey:@"IsDelete"];
    [dic setObject:detailEntity.Selected forKey:@"Selected"];
    [dic setObject:detailEntity.OOSFreeQty forKey:@"OOSFreeQty"];
    [dic setObject:detailEntity.PromotionRuleGuid forKey:@"PromotionRuleGuid"];
    [dic setObject:detailEntity.PromotionRuleDtlID_Bill forKey:@"PromotionRuleDtlID_Bill"];
    [dic setObject:detailEntity.PromotionRuleDtlUsedMoney forKey:@"PromotionRuleDtlUsedMoney"];
    [dic setObject:detailEntity.ProdID forKey:@"ProdID"];
    [dic setObject:detailEntity.OrgCode forKey:@"OrgCode"];
    [dic setObject:detailEntity.PriceType forKey:@"PriceType"];
    [dic setObject:detailEntity.PresentFlag forKey:@"PresentFlag"];
    [dic setObject:detailEntity.AddMoney forKey:@"AddMoney"];
    [dic setObject:detailEntity.DivSalesValue forKey:@"DivSalesValue"];
    [dic setObject:detailEntity.CutMoney forKey:@"CutMoney"];
    [dic setObject:detailEntity.IntnlBarcode forKey:@"IntnlBarcode"];
    [dic setObject:detailEntity.RemarkCode forKey:@"RemarkCode"];
    [dic setObject:detailEntity.SuggestPrice forKey:@"SuggestPrice"];
    [dic setObject:detailEntity.StaffTicket forKey:@"StaffTicket"];
    [dic setObject:detailEntity.SaleDetailID forKey:@"SaleDetailID"];
    [dic setObject:detailEntity.BrandID forKey:@"BrandID"];
    [dic setObject:detailEntity.OldDiscountRate forKey:@"OldDiscountRate"];
    [dic setObject:detailEntity.InnerBarcode forKey:@"InnerBarcode"];
    [dic setObject:detailEntity.GuidID forKey:@"GuidID"];
    [dic setObject:detailEntity.EditionName forKey:@"EditionName"];
    [dic setObject:detailEntity.RetailPrice forKey:@"RetailPrice"];
    [dic setObject:detailEntity.ContainerID forKey:@"ContainerID"];
    [dic setObject:detailEntity.DecMoney forKey:@"DecMoney"];
    [dic setObject:detailEntity.SellerUserID forKey:@"SellerUserID"];
    [dic setObject:detailEntity.PresentHandIdx forKey:@"PresentHandIdx"];
    [dic setObject:detailEntity.OwnerOrgCode forKey:@"OwnerOrgCode"];
    [dic setObject:detailEntity.Orientation forKey:@"Orientation"];
    [dic setObject:detailEntity.DiscountRate forKey:@"DiscountRate"];
    [dic setObject:detailEntity.OOSMarketGain forKey:@"OOSMarketGain"];
    [dic setObject:detailEntity.EntityState forKey:@"EntityState"];
    [dic setObject:detailEntity.PriceTypeName forKey:@"PriceTypeName"];
    [dic setObject:detailEntity.BrandCode forKey:@"BrandCode"];
    [dic setObject:detailEntity.OOSBanggoGain forKey:@"OOSBanggoGain"];
    [dic setObject:detailEntity.ProdYear forKey:@"ProdYear"];
    [dic setObject:detailEntity.ProdClsID forKey:@"ProdClsID"];
    [dic setObject:detailEntity.SeasonCode forKey:@"SeasonCode"];
    [dic setObject:detailEntity.ItemNo forKey:@"ItemNo"];
    [dic setObject:detailEntity.OOSCompGain forKey:@"OOSCompGain"];
    [dic setObject:detailEntity.Remark forKey:@"Remark"];
    [dic setObject:detailEntity.SalesMode forKey:@"SalesMode"];
    // edit by maosy,add model params for SalesPrice. edit by 20140326
    if (detailEntity.SalesPrice  != nil) {
        [dic setObject:detailEntity.SalesPrice forKey:@"SalesPrice"];
    }
    return dic ;
}

@end